package DataStruction;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class List {
    public static void main(String[] args) {
        rollCall();
    }

    public static void arrayList() {
        ArrayList<String> arrayList = new ArrayList<>();
        Collections.addAll(arrayList, "蔡徐坤", "丁真");
        System.out.println(arrayList.indexOf("丁真"));
    }

    //    随机点名
    public static void rollCall() {
        ArrayList<String> students = new ArrayList<>();
        Collections.addAll(students, "洛天依", "蔡徐坤", "丁真", "肖战", "易烊千玺");
        Random r = new Random();
        System.out.println("随机点名:" + students.get(r.nextInt(students.size())));
    }

}
